package com.lanyuan.a.bean;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;

@Entity
@Table(name="ly_window_sale")
public class WindowSale {
	private int id;
	private int w_f_id;
	private int w_id;
	private String w_name;
	private int c_id;
	private String c_name;
	private int f_id;
	private String f_name;
	private double f_price;
	private int f_salenum;
	private String f_type;
	private Date saledate;
	private int saleyear;
	private int salemonth;
	@Id
	@GenericGenerator(name = "generator", strategy = "native")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 20)
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	@Column(name = "w_id", length = 20)
	public int getW_id() {
		return w_id;
	}
	public void setW_id(int w_id) {
		this.w_id = w_id;
	}
	@Column(name = "w_name", length = 20)
	public String getW_name() {
		return w_name;
	}
	public void setW_name(String w_name) {
		this.w_name = w_name;
	}
	@Column(name = "c_id", length = 20)
	public int getC_id() {
		return c_id;
	}
	public void setC_id(int c_id) {
		this.c_id = c_id;
	}
	@Column(name = "c_name", length = 20)
	public String getC_name() {
		return c_name;
	}
	public void setC_name(String c_name) {
		this.c_name = c_name;
	}
	@Column(name = "f_name", length = 20)
	public String getF_name() {
		return f_name;
	}
	public void setF_name(String f_name) {
		this.f_name = f_name;
	}
	@Column(name = "f_price", length = 20)
	public double getF_price() {
		return f_price;
	}
	public void setF_price(double f_price) {
		this.f_price = f_price;
	}
	@Column(name = "f_salenum", length = 20)
	public int getF_salenum() {
		return f_salenum;
	}
	public void setF_salenum(int f_salenum) {
		this.f_salenum = f_salenum;
	}
	@Column(name = "saledate", length = 20)
	public Date getSaledate() {
		return saledate;
	}
	public void setSaledate(Date saledate) {
		this.saledate = saledate;
	}
	@Column(name = "saleyear", length = 20)
	public int getSaleyear() {
		return saleyear;
	}
	public void setSaleyear(int saleyear) {
		this.saleyear = saleyear;
	}
	@Column(name = "salemonth", length = 20)
	public int getSalemonth() {
		return salemonth;
	}
	public void setSalemonth(int salemonth) {
		this.salemonth = salemonth;
	}
	@Override
	public String toString() {
		return "WindowSale [id=" + id +  ", w_f_id =" + w_f_id  + ", w_id=" + w_id + ", w_name=" + w_name
				+ ", c_id=" + c_id + ", c_name=" + c_name + ", f_name="
				+ f_name + ", f_price=" + f_price + ", f_salenum=" + f_salenum
				+ ", saledate=" + saledate + ", saleyear=" + saleyear
				+ ", salemonth=" + salemonth +"]";
	}
	@Column(name = "w_f_id", length = 20)
	public int getW_f_id() {
		return w_f_id;
	}
	public void setW_f_id(int w_f_id) {
		this.w_f_id = w_f_id;
	}
	@Column(name = "f_type", length = 20)
	public String getF_type() {
		return f_type;
	}
	public void setF_type(String f_type) {
		this.f_type = f_type;
	}
	@Column(name = "f_id", length = 20)
	public int getF_id() {
		return f_id;
	}
	public void setF_id(int f_id) {
		this.f_id = f_id;
	}
	
	public WindowSale() {
		super();
	}
	public WindowSale(int id, int w_f_id, int w_id, String w_name, int c_id,
			String c_name, int f_id, String f_name, double f_price,
			int f_salenum, String f_type, Date saledate, int saleyear,
			int salemonth) {
		super();
		this.id = id;
		this.w_f_id = w_f_id;
		this.w_id = w_id;
		this.w_name = w_name;
		this.c_id = c_id;
		this.c_name = c_name;
		this.f_id = f_id;
		this.f_name = f_name;
		this.f_price = f_price;
		this.f_salenum = f_salenum;
		this.f_type = f_type;
		this.saledate = saledate;
		this.saleyear = saleyear;
		this.salemonth = salemonth;
	}
	public void setWindowFoodValue(WindowFood wf){
		this.setW_f_id(wf.getW_f_id());
		this.setW_id(wf.getW_id());
		this.setW_name(wf.getW_name());
		this.setC_name(wf.getC_name());
		this.setC_id(wf.getC_id());
		this.setF_name(wf.getF_name());
		this.setF_price(wf.getF_price());
		this.setF_type(wf.getF_type());
		this.setF_id(wf.getF_id());
		
		this.setSaledate(new Date());
		this.setSaleyear(new Date().getYear());
		this.setSalemonth(new Date().getMonth());
	}
}
